package com.android.component;

import com.utils.LogUtil;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

public class CoreService extends Service {

    private static final String TAG = "CoreService";

    public class MyBinder extends Binder {
        public CoreService getService() {
            return CoreService.this;
        }
    }

    public void doWork() {
        LogUtil.d(TAG, "doWork in thread:" + Thread.currentThread().getId());
    }

    @Override
    public IBinder onBind(Intent intent) {
        return new MyBinder();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        LogUtil.d(TAG, "create");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        LogUtil.d(TAG, "onStartCommand flag:" + flags + ",startid:" + startId);
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        LogUtil.d(TAG, "onDestroy");
        super.onDestroy();
    }
}
